<template>
	<view>
		<view style="height: 100vh; position: fixed; top: 0;">
			<image style="width: 100vw; height: 100vh;" mode="aspectFill" src="../static/image/bg.jpg"  />
		</view>
		<view style="height: 100vh; display: flex; justify-content: flex-end; flex-direction: column;">
			<view style="height: 60%; display: flex; flex-direction: column; justify-content: flex-end;">
				<view style="justify-content: center; display: flex; flex-direction: column; align-items: center; height: 100%;">
					<image @click="toabout"  mode="aspectFit" src="../static/image/gy.png"></image>
					<image @click="torh" mode="aspectFit" src="../static/image/rh.png"></image>
					<image @click="toContact" mode="aspectFit" src="../static/image/lx.png"></image>
				</view>
				<view style="width: 100%;" class="padding-lg">
					<button style="width: 100%; background-color: #FDF100; color: #29221A; font-weight: bold;" class="cu-btn padding-xl text-xl" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">进门自习</button>
				</view>
			</view>
		</view>
		<!-- <view style="height: 100vh; justify-content: end;"  class="flex flex-direction">
			<view style="height: 60%; background-color: #FF0000;">
				<view class="flex flex-direction " style="justify-content: center; align-items: center; height: 60%;">
					<image mode="aspectFit" src="../static/image/gy.jpg"></image>
					<image mode="aspectFit" src="../static/image/rh.png"></image>
					<image mode="aspectFit" src="../static/image/lx.png"></image>
				</view>
				<view style="width: 100%;" class="padding-lg">
					<button style="width: 100%; background-color: #FDF100; color: #29221A; font-weight: bold;" class="cu-btn padding-xl text-xl" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">进门自习</button>
				</view>
			</view>
		</view> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				show: false,
				to: "author",
				nrs: []
			}
		},
		onLoad: function(option) {
			let accountInfo = uni.getAccountInfoSync();
			let appId = accountInfo.miniProgram.appId;
			this.http.get({
				url: "/store/info",
				param: {
					appId,
				}
			}).then(res => {
				this.common.setAttribute("store", res);
			});
		},
		methods: {
			toContact: function() {
				uni.navigateTo({
					url: "../pages/contact"
				});
			},
			torh: function() {
				uni.navigateTo({
					url: "../pages/rh"
				});
			},
			toabout: function() {
				uni.navigateTo({
					url: "../pages/about"
				});
			},
			getPhoneNumber: function(e) {
				let phoneCode = e.detail.code;
				let accountInfo = uni.getAccountInfoSync();
				let appId = accountInfo.miniProgram.appId;
				uni.login({
					success: res => {
						this.http.get({
							url: "/client/login/wx-code",
							param: {
								code: res.code,
								appId,
								phoneCode,
							}
						}).then(res => {
							this.common.setAttribute("store", res.store);
							this.common.setAttribute("autor", res);
							uni.redirectTo({
								url: "../pages/author"
							});
						});
					}
				});
			},
		}
	}
</script>

<style scoped>
</style>
